package com.zcbl.toolkit.logger;

import org.apache.ibatis.jdbc.SQL;

public class SurveyCaseOperateSqlProvider {

    public String insertSelective(SurveyCaseOperate record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("survey_case_operate");
        
        if (record.getUserId() != null) {
            sql.VALUES("user_id", "#{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getCaseNo() != null) {
            sql.VALUES("case_no", "#{caseNo,jdbcType=VARCHAR}");
        }
        
        if (record.getInterfaceUrl() != null) {
            sql.VALUES("interface_url", "#{interfaceUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getClientIp() != null) {
            sql.VALUES("client_ip", "#{clientIp,jdbcType=VARCHAR}");
        }
        
        if (record.getModuleType() != null) {
            sql.VALUES("module_type", "#{moduleType,jdbcType=VARCHAR}");
        }
        
        if (record.getOperateDes() != null) {
            sql.VALUES("operate_des", "#{operateDes,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRemark() != null) {
            sql.VALUES("remark", "#{remark,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(SurveyCaseOperate record) {
        SQL sql = new SQL();
        sql.UPDATE("survey_case_operate");
        
        if (record.getUserId() != null) {
            sql.SET("user_id = #{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getCaseNo() != null) {
            sql.SET("case_no = #{caseNo,jdbcType=VARCHAR}");
        }
        
        if (record.getInterfaceUrl() != null) {
            sql.SET("interface_url = #{interfaceUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getClientIp() != null) {
            sql.SET("client_ip = #{clientIp,jdbcType=VARCHAR}");
        }
        
        if (record.getModuleType() != null) {
            sql.SET("module_type = #{moduleType,jdbcType=VARCHAR}");
        }
        
        if (record.getOperateDes() != null) {
            sql.SET("operate_des = #{operateDes,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRemark() != null) {
            sql.SET("remark = #{remark,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}